from socket import *
import struct
u_client = socket(AF_INET, SOCK_DGRAM)

stu_id=eval(input("请输入学生编号"))
stu_name=input("请输入学生姓名")
stu_score=eval(input("请输入学生成绩"))
stu_age=eval(input("请输入学生年龄"))

data=struct.pack("i10sfi",stu_id,stu_name.encode(),stu_score,stu_age)
u_client.sendto(data,('127.0.0.1', 9999))
data, addr = u_client.recvfrom(1024)
print(data.decode())